function isSpecial(evt){

	 var charCode = (evt.which) ? evt.which : event.keyCode;
	 if (charCode == 8 || charCode == 46 || (charCode==32)|| (charCode>=37 && charCode<=40))
	    return true;
	
	 return false;	
}

function isArrowKey(evt){
	 var charCode = (evt.which) ? evt.which : event.keyCode;
	 if (charCode == 8 || (charCode>=37 && charCode<=40))
	    return true;
	 return false;	
}


function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode;
 if (charCode >= 48 && charCode <= 57)
    return true;

 return false;
}

function isValid(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
 	if ((charCode >= 48 && charCode <= 57) || (charCode>=65 && charCode<=90) || (charCode>=97 && charCode<=122))
   		return true;
 	return false;

}

function isAlphabet(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
 	if ((charCode>=65 && charCode<=90) || (charCode>=97 && charCode<=122))
   		return true;
 	return false;
}


function sortInventory(){
	$sort = document.getElementById('sort').value;
	$order = document.getElementById('order').value;
	window.location.href='admininventory.php?sort='+$sort+"&order="+$order;
}

function sortCustomers(){
	$sort = document.getElementById('sort').value;
	$order = document.getElementById('order').value;
	window.location.href='admincustomer.php?sort='+$sort+"&order="+$order;
}

function sortOrders(){
	$sort = document.getElementById('sort').value;
	$order = document.getElementById('order').value;
	window.location.href='adminorders.php?sort='+$sort+"&order="+$order;
}

function sortReport(){
	$sort = document.getElementById('sort').value;
	$order = document.getElementById('order').value;
	window.location.href='adminreport.php?sort='+$sort+"&order="+$order;
}

function sortInventoryOrder(){
	$sort = document.getElementById('sort').value;
	$order = document.getElementById('order').value;
	window.location.href='admininventoryorders.php?sort='+$sort+"&order="+$order;

}


function validateOrderMore(){

	if($("#quantity").val().length<=0){
		alert("Enter value for quantity");
		return false;
	}
	return true;
}

function validateEditItemForm(){
    var msg='';

   
    if($("#itemName").val().length<=0)
        msg= msg+'Enter Item Name\n';
     if($("#description").val().length<=0)
        msg= msg+'Enter Description\n';
    if($("#price").val().length<=0)
        msg= msg+'Enter Price\n';
    if($("#availability").val().length<=0)
        msg= msg+'Enter no of items available\n';
    if($("#smallimage").val().length<=0)
        msg= msg+'Enter Small Image File\n';
	 if($("#largeimage").val().length<=0)
        msg= msg+'Enter Large Image File\n';
        



    if(msg!=''){
        alert(msg);
        return false;
    }

    return true;

}